﻿using System;
using System.Collections.Generic;

namespace maranov.SymlinkManager.ApplicationPrivilege
{
    public interface IApplicationPrivilegeElevator
    {
        /// <summary>
        /// Elevates the process by restarting it with Administrator privileges.
        /// </summary>
        /// <param name="termination">
        /// Called after elevated process is created to terminate current.
        /// </param>
        void Elevate(ApplicationTerminator termination);

        /// <summary>
        /// Checks if all required tests pass.
        /// </summary>
        /// <returns>
        /// True if all the tests passed correctly.
        /// </returns>
        bool Check();

        /// <summary>
        /// Checks if all required tests pass and automatically elevates the process
        /// by restarting it with Administrator privileges if any of the tests fails.
        /// </summary>
        /// <param name="termination">
        /// Called after elevated process is created to terminate current.
        /// </param>
        void CheckAndElevate(ApplicationTerminator termination);

        /// <summary>
        /// If true, current process is already elevated to Administrator level.
        /// </summary>
        bool IsElevated();

        /// <summary>
        /// Tests required to pass the privilege check.
        /// </summary>
        IEnumerable<PrivilegeCheck> RequiredTests 
        {
            get;
        }
    }
}
